package beans;

import com.google.gson.Gson;

// just a simple object to store the data for a line item in the taskboard (one row from the database query)
public class TaskboardItemBean {
	UserStoryBean userStory = new UserStoryBean();
	TaskBean task = new TaskBean();
	
	public int getUserStoryId() {
		return userStory.getId();
	}
	
	public void setUserStoryId(int userStoryId) {
		userStory.setId(userStoryId);
	}
	
	public String getUserStoryName() {
		return userStory.getName();
	}
	
	public void setUserStoryName(String userStoryName) {
		userStory.setName(userStoryName);
	}
	
	public String getUserStoryDescription() {
		return userStory.getDescription();
	}
	
	public void setUserStoryDescription(String userStoryDescription) {
		userStory.setDescription(userStoryDescription);
	}
	
	public void setUserStoryTypeName(String userStoryTypeName) {
		userStory.setTypeName(userStoryTypeName);
	}
	
	public String getUserStoryTypeName() {
		return userStory.getTypeName();
	}
	
	public Integer getUserStoryStoryPoints() {
		return userStory.getStoryPoints();
	}

	public void setUserStoryStoryPoints(Integer storyPoints) {
		userStory.setStoryPoints(storyPoints);
	}

	public int getTaskId() {
		return task.getId();
	}

	public void setTaskId(int taskId) {
		task.setId(taskId);
	}

	public String getTaskName() {
		return task.getName();
	}
	
	public void setTaskName(String taskName) {
		task.setName(taskName);
	}

	public String getTaskDescription() {
		return task.getDescription();
	}
	
	public void setTaskDescription(String taskDescription) {
		task.setDescription(taskDescription);
	}
	
	public float getEstimate() {
		return task.getEstimate();
	}
	
	public void setEstimate(float estimate) {
		task.setEstimate(estimate);
	}
	
	public int getStatusId() {
		return task.getStatusId();
	}
	
	public void setStatusId(int statusId) {
		task.setStatusId(statusId);
	}

	public String getStatusName() {
		return task.getStatusName();
	}
	
	public void setStatusName(String statusName) {
		task.setStatusName(statusName);
	}
	public String getAssignedTo() {
		return task.getAssignedTo();
	}
	
	public void setAssignedTo(String assignedTo) {
		task.setAssignedTo(assignedTo);
	}
	
	public String getJson() {
		StringBuffer sb = new StringBuffer();
		Gson gson = new Gson();
		
		sb.append("{");
		sb.append("\"user_story_id\": " + gson.toJson(getUserStoryId()) + ",");
		sb.append("\"user_story_name\": " + gson.toJson(getUserStoryName()) + ",");
		sb.append("\"user_story_description\": " + gson.toJson(getUserStoryDescription()) + ",");
		sb.append("\"user_story_type_name\": " + gson.toJson(getUserStoryTypeName()) + ",");
		sb.append("\"user_story_story_points\": " + gson.toJson(getUserStoryStoryPoints()) + ",");
		sb.append("\"task_id\": " + gson.toJson(getTaskId()) + ",");
		sb.append("\"task_name\": " + gson.toJson(getTaskName()) + ",");
		sb.append("\"task_description\": " + gson.toJson(getTaskDescription()) + ",");
		sb.append("\"estimate\": " + gson.toJson(getEstimate()) + ",");
		sb.append("\"status_id\": " + gson.toJson(getStatusId()) + ",");
		sb.append("\"status_name\": " + gson.toJson(getStatusName()) + ",");
		sb.append("\"assigned_to\": " + gson.toJson(getAssignedTo()));
		sb.append("}");
		
		return sb.toString();
	}
	
}
